using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace DTO
{
	/// <summary> 
	///Author: nnamthach@gmail.com 
	/// <summary>
	
    public class CONGNOInfo
    {
		#region Local Variable
		public enum Field
		{
			ID,
			SOCT,
			NGAYCT,
			DIACHIKH,
			DIENTHOAI,
			PHAITHU,
			D_C,
			SOTIEN,
			NOIDUNG,
			MAKH,
			SOCTTT,
			CREATEBY,
			MODIFIEDBY,
			CREATEDATE,
			MODIFIEDDATE
		}
		private Int64 _ID;
		private String _SOCT;
		private DateTime _NGAYCT;
		private String _DIACHIKH;
		private String _DIENTHOAI;
		private Boolean _PHAITHU;
		private String _D_C;
		private Double _SOTIEN;
		private String _NOIDUNG;
		private String _MAKH;
		private String _SOCTTT;
		private String _CREATEBY;
		private String _MODIFIEDBY;
		private DateTime _CREATEDATE;
		private DateTime _MODIFIEDDATE;
		
		public Int64 ID{	get{ return _ID;} set{_ID = value;} }
		public String SOCT{	get{ return _SOCT;} set{_SOCT = value;} }
		public DateTime NGAYCT{	get{ return _NGAYCT;} set{_NGAYCT = value;} }
		public String DIACHIKH{	get{ return _DIACHIKH;} set{_DIACHIKH = value;} }
		public String DIENTHOAI{	get{ return _DIENTHOAI;} set{_DIENTHOAI = value;} }
		public Boolean PHAITHU{	get{ return _PHAITHU;} set{_PHAITHU = value;} }
		public String D_C{	get{ return _D_C;} set{_D_C = value;} }
		public Double SOTIEN{	get{ return _SOTIEN;} set{_SOTIEN = value;} }
		public String NOIDUNG{	get{ return _NOIDUNG;} set{_NOIDUNG = value;} }
		public String MAKH{	get{ return _MAKH;} set{_MAKH = value;} }
		public String SOCTTT{	get{ return _SOCTTT;} set{_SOCTTT = value;} }
		public String CREATEBY{	get{ return _CREATEBY;} set{_CREATEBY = value;} }
		public String MODIFIEDBY{	get{ return _MODIFIEDBY;} set{_MODIFIEDBY = value;} }
		public DateTime CREATEDATE{	get{ return _CREATEDATE;} set{_CREATEDATE = value;} }
		public DateTime MODIFIEDDATE{	get{ return _MODIFIEDDATE;} set{_MODIFIEDDATE = value;} }
		
        #endregion LocalVariable
        
        #region Constructor
		public CONGNOInfo()
		{
			_ID = 0;
			_SOCT = "";
			_NGAYCT = DateTime.Now;
			_DIACHIKH = "";
			_DIENTHOAI = "";
			_PHAITHU = true;
			_D_C = "";
			_SOTIEN = 0;
			_NOIDUNG = "";
			_MAKH = "";
			_SOCTTT = "";
			_CREATEBY = "";
			_MODIFIEDBY = "";
			_CREATEDATE = DateTime.Now;
			_MODIFIEDDATE = DateTime.Now;
		}
		public CONGNOInfo(
		Int64 ID,
		String SOCT,
		DateTime NGAYCT,
		String DIACHIKH,
		String DIENTHOAI,
		Boolean PHAITHU,
		String D_C,
		Double SOTIEN,
		String NOIDUNG,
		String MAKH,
		String SOCTTT,
		String CREATEBY,
		String MODIFIEDBY,
		DateTime CREATEDATE,
		DateTime MODIFIEDDATE
		)
		{
			_ID = ID;
			_SOCT = SOCT;
			_NGAYCT = NGAYCT;
			_DIACHIKH = DIACHIKH;
			_DIENTHOAI = DIENTHOAI;
			_PHAITHU = PHAITHU;
			_D_C = D_C;
			_SOTIEN = SOTIEN;
			_NOIDUNG = NOIDUNG;
			_MAKH = MAKH;
			_SOCTTT = SOCTTT;
			_CREATEBY = CREATEBY;
			_MODIFIEDBY = MODIFIEDBY;
			_CREATEDATE = CREATEDATE;
			_MODIFIEDDATE = MODIFIEDDATE;
		}
		public CONGNOInfo(DataRow dr)
		{
			if (dr != null)
			{
				_ID = dr[Field.ID.ToString()] == DBNull.Value?0:Convert.ToInt64(dr[Field.ID.ToString()]);
				_SOCT = dr[Field.SOCT.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.SOCT.ToString()]);
				_NGAYCT = dr[Field.NGAYCT.ToString()] == DBNull.Value?DateTime.Now:Convert.ToDateTime(dr[Field.NGAYCT.ToString()]);
				_DIACHIKH = dr[Field.DIACHIKH.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.DIACHIKH.ToString()]);
				_DIENTHOAI = dr[Field.DIENTHOAI.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.DIENTHOAI.ToString()]);
				_PHAITHU = dr[Field.PHAITHU.ToString()] == DBNull.Value?true:Convert.ToBoolean(dr[Field.PHAITHU.ToString()]);
				_D_C = dr[Field.D_C.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.D_C.ToString()]);
				_SOTIEN = dr[Field.SOTIEN.ToString()] == DBNull.Value?0:Convert.ToDouble(dr[Field.SOTIEN.ToString()]);
				_NOIDUNG = dr[Field.NOIDUNG.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.NOIDUNG.ToString()]);
				_MAKH = dr[Field.MAKH.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.MAKH.ToString()]);
				_SOCTTT = dr[Field.SOCTTT.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.SOCTTT.ToString()]);
				_CREATEBY = dr[Field.CREATEBY.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.CREATEBY.ToString()]);
				_MODIFIEDBY = dr[Field.MODIFIEDBY.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.MODIFIEDBY.ToString()]);
				_CREATEDATE = dr[Field.CREATEDATE.ToString()] == DBNull.Value?DateTime.Now:Convert.ToDateTime(dr[Field.CREATEDATE.ToString()]);
				_MODIFIEDDATE = dr[Field.MODIFIEDDATE.ToString()] == DBNull.Value?DateTime.Now:Convert.ToDateTime(dr[Field.MODIFIEDDATE.ToString()]);
			}
		}
		public CONGNOInfo(DataRowView dr)
		{
			if (dr != null)
			{
				_ID = dr[Field.ID.ToString()] == DBNull.Value?0:Convert.ToInt64(dr[Field.ID.ToString()]);
				_SOCT = dr[Field.SOCT.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.SOCT.ToString()]);
				_NGAYCT = dr[Field.NGAYCT.ToString()] == DBNull.Value?DateTime.Now:Convert.ToDateTime(dr[Field.NGAYCT.ToString()]);
				_DIACHIKH = dr[Field.DIACHIKH.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.DIACHIKH.ToString()]);
				_DIENTHOAI = dr[Field.DIENTHOAI.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.DIENTHOAI.ToString()]);
				_PHAITHU = dr[Field.PHAITHU.ToString()] == DBNull.Value?true:Convert.ToBoolean(dr[Field.PHAITHU.ToString()]);
				_D_C = dr[Field.D_C.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.D_C.ToString()]);
				_SOTIEN = dr[Field.SOTIEN.ToString()] == DBNull.Value?0:Convert.ToDouble(dr[Field.SOTIEN.ToString()]);
				_NOIDUNG = dr[Field.NOIDUNG.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.NOIDUNG.ToString()]);
				_MAKH = dr[Field.MAKH.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.MAKH.ToString()]);
				_SOCTTT = dr[Field.SOCTTT.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.SOCTTT.ToString()]);
				_CREATEBY = dr[Field.CREATEBY.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.CREATEBY.ToString()]);
				_MODIFIEDBY = dr[Field.MODIFIEDBY.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.MODIFIEDBY.ToString()]);
				_CREATEDATE = dr[Field.CREATEDATE.ToString()] == DBNull.Value?DateTime.Now:Convert.ToDateTime(dr[Field.CREATEDATE.ToString()]);
				_MODIFIEDDATE = dr[Field.MODIFIEDDATE.ToString()] == DBNull.Value?DateTime.Now:Convert.ToDateTime(dr[Field.MODIFIEDDATE.ToString()]);
			}
		}
		public CONGNOInfo(CONGNOInfo objEntr)
		{			
			_ID = objEntr.ID;			
			_SOCT = objEntr.SOCT;			
			_NGAYCT = objEntr.NGAYCT;			
			_DIACHIKH = objEntr.DIACHIKH;			
			_DIENTHOAI = objEntr.DIENTHOAI;			
			_PHAITHU = objEntr.PHAITHU;			
			_D_C = objEntr.D_C;			
			_SOTIEN = objEntr.SOTIEN;			
			_NOIDUNG = objEntr.NOIDUNG;			
			_MAKH = objEntr.MAKH;			
			_SOCTTT = objEntr.SOCTTT;			
			_CREATEBY = objEntr.CREATEBY;			
			_MODIFIEDBY = objEntr.MODIFIEDBY;			
			_CREATEDATE = objEntr.CREATEDATE;			
			_MODIFIEDDATE = objEntr.MODIFIEDDATE;			
		}
        #endregion Constructor
        
        #region InitTable
		public static DataTable ToDataTable()
		{
			DataTable dt = new DataTable("CONGNO");
			dt.Columns.AddRange(new DataColumn[] { 
				new DataColumn(Field.ID.ToString(), typeof(Int64)),
				new DataColumn(Field.SOCT.ToString(), typeof(String)),
				new DataColumn(Field.NGAYCT.ToString(), typeof(DateTime)),
				new DataColumn(Field.DIACHIKH.ToString(), typeof(String)),
				new DataColumn(Field.DIENTHOAI.ToString(), typeof(String)),
				new DataColumn(Field.PHAITHU.ToString(), typeof(Boolean)),
				new DataColumn(Field.D_C.ToString(), typeof(String)),
				new DataColumn(Field.SOTIEN.ToString(), typeof(Double)),
				new DataColumn(Field.NOIDUNG.ToString(), typeof(String)),
				new DataColumn(Field.MAKH.ToString(), typeof(String)),
				new DataColumn(Field.SOCTTT.ToString(), typeof(String)),
				new DataColumn(Field.CREATEBY.ToString(), typeof(String)),
				new DataColumn(Field.MODIFIEDBY.ToString(), typeof(String)),
				new DataColumn(Field.CREATEDATE.ToString(), typeof(DateTime)),
				new DataColumn(Field.MODIFIEDDATE.ToString(), typeof(DateTime))
			});
			return dt;
		}
		public DataRow ToDataRow(DataTable dt)
		{
			DataRow row = dt.NewRow();
			row[Field.ID.ToString()] = _ID;
			row[Field.SOCT.ToString()] = _SOCT;
			row[Field.NGAYCT.ToString()] = _NGAYCT;
			row[Field.DIACHIKH.ToString()] = _DIACHIKH;
			row[Field.DIENTHOAI.ToString()] = _DIENTHOAI;
			row[Field.PHAITHU.ToString()] = _PHAITHU;
			row[Field.D_C.ToString()] = _D_C;
			row[Field.SOTIEN.ToString()] = _SOTIEN;
			row[Field.NOIDUNG.ToString()] = _NOIDUNG;
			row[Field.MAKH.ToString()] = _MAKH;
			row[Field.SOCTTT.ToString()] = _SOCTTT;
			row[Field.CREATEBY.ToString()] = _CREATEBY;
			row[Field.MODIFIEDBY.ToString()] = _MODIFIEDBY;
			row[Field.CREATEDATE.ToString()] = _CREATEDATE;
			row[Field.MODIFIEDDATE.ToString()] = _MODIFIEDDATE;
			return row;
		}
        #endregion InitTable
    }
}
